﻿using System;
using System.Data;
using System.Web;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using AnyOffice.Components;
using AnyOffice.DAL;
using AnyOffice.Model;
namespace AnyOffice.general.system.workflow.flow_sort
{
    public partial class sort_edit : ModulePage
    {       

        protected void Page_Load(object sender, EventArgs e)
        {
            if (!this.Page.IsPostBack)
            {
                int num = (Request.QueryString["sort_id"] == null) ? 0 : int.Parse(Request.QueryString["sort_id"].ToString());
                this.ViewState["SortId"] = num;
                DataTable table = new FlowSortDao().SelectBySortId(base.Conn, num);
                if (table.Rows.Count > 0)
                {
                    this.txtSortNo.Text = table.Rows[0]["SortNo"].ToString();
                    this.txtSortName.Text = table.Rows[0]["SortName"].ToString();
                }
                else
                {
                    this.pnlMain.Visible = false;
                    this.litMessage.Text = base.ShowError("无流程分类记录", "index.aspx");
                }
            }
            if (this.Page.IsPostBack)
            {
                FlowSortDao dao2 = new FlowSortDao();
                FlowSortData data = new FlowSortData();
                data.SortId = Convert.ToInt32(this.ViewState["SortId"]);
                data.SortNo = Convert.ToInt32(this.txtSortNo.Text);
                data.SortName = this.txtSortName.Text;
                dao2.Update(base.Conn, data);
                base.CloseConn();
                Response.Redirect("index.aspx");
            }
        }
   
    }
}

